//app.js
App({
  onLaunch: function () {


    // // 展示本地存储能力
    // var logs = wx.getStorageSync('logs') || []
    // logs.unshift(Date.now())
    // wx.setStorageSync('logs', logs)
    var that = this;
    // 获取用户信息
    wx.getSetting({
      success: res => {
        if (res.authSetting['scope.userInfo']) {
          // 已经授权，可以直接调用 getUserInfo 获取头像昵称，不会弹框
          wx.getUserInfo({
            success: res => {
              // 可以将 res 发送给后台解码出 unionId
              this.globalData.userInfo = res.userInfo
              console.log('获取用户登录态成功1！' + res.errMsg)
              console.log(res);
              // 由于 getUserInfo 是网络请求，可能会在 Page.onLoad 之后才返回
              // 所以此处加入 callback 以防止这种情况
              if (this.userInfoReadyCallback) {
                this.userInfoReadyCallback(res)
                console.log('获取用户登录态成功2！' + res.errMsg)
                console.log(res);
              }
            }
          })
        }
      }
    })

  },




  globalData: {
    userInfo: null,
    wxcode: null,
    islogin: false,
    timespan: null,
    key: "rongtongjygyteacher",
    appType: "2",
    appKey: null,
    serverUrl: 'https://apps.beiguanhuai.com/jygynew/api/app_teacher/',
    serverQiNiuUrl: 'https://apps.beiguanhuai.com/jygynew/UploadQn.Json',
    qiniurUrl: 'http://img.beiguanhuai.com',
    serverFaceUrl: 'https://m.beiguanhuai.com/public/faceWechat.json',
    userId: null,
    schoolId: null,
    url: null,
    classid: null,
    classname: null,
    classlist: null,
    schoolName: null,
    photo: null,
    cardno: null,
    zhiboUrl: null,
    name:null,
    familyId:0
  }

//https://m.beiguanhuai.com/public/faceWechat.json
  //https://apps.beiguanhuai.com/jygynew/api/app_teacher/
  // appid:'wx87159153f65b59cc',//appid需自己提供，此处的appid我随机编写
  // secret:'c9191b0f0f1b65368e9ca8350ee87c7e',
 //http://192.168.8.104:8080/rongtongbgh/public/faceWechat.json
 // serverFaceUrl: 'https://m.beiguanhuai.com/public/faceWechat.json',
  // serverUrl:'https://t.beiguanhuai.com/jygynew/api/app_parent/',

  // serverUrl:'http://app.beiguanhuai.com/rongtongjygy/api/app_parent/',
  // 'https://t.beiguanhuai.com/jygynew/api/app_teacher/',
})